﻿#region

using System;
using System.ServiceModel;

#endregion

namespace BuildMotion.MotionTracker.ConsoleHost
{
    public class Program
    {
        private static ServiceHost motionTrackerService = null;

        private static void Main(string[] args)
        {
            // Make sure the services are closed before attempting to instantiate/open;
            CloseServices();

            // Instantiate and open each service;
            motionTrackerService = new ServiceHost(typeof (MotionTrackerWCFService));
            motionTrackerService.Open();

            Console.WriteLine("Press <enter> to terminate the Host application.");
            Console.WriteLine();
            Console.ReadLine();
        }

        /// <summary>
        /// Closes the services.
        /// </summary>
        private static void CloseServices()
        {
            if (motionTrackerService != null)
            {
                motionTrackerService.Close();
            }
        }
    }
}